package jzOffer;

public class Num54 {
    int res,k;
    public int kthLargest(TreeNode root, int k) {
        this.k=k;
        preOrder(root);
        return res;
    }
    private void preOrder(TreeNode root){
        if(root==null) return;
        preOrder(root.right);
        if(k==0) return;
        if(--k==0) res=root.val;
        preOrder(root.left);
    }
}
